﻿<navigation:Page x:Class="AppShare.Calc" 
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    mc:Ignorable="d"
    xmlns:navigation="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Navigation"
    xmlns:local="clr-namespace:AppShare.Controls"
    xmlns:app="clr-namespace:AppShare"
    xmlns:toolkit="http://schemas.microsoft.com/winfx/2006/xaml/presentation/toolkit" 
    d:DesignWidth="640" d:DesignHeight="480"
    Style="{StaticResource PageStyle}">

    <navigation:Page.Resources>
        <app:NotVisibilityConverter x:Key="NotVisibilityConverter" />
        <app:NotBooleanConverter x:Key="NotBooleanConverter" />
    </navigation:Page.Resources>

    <Grid x:Name="LayoutRoot" AllowDrop="True">
        <ScrollViewer x:Name="PageScrollViewer" Style="{StaticResource PageScrollViewerStyle}" >

            <StackPanel x:Name="ContentStackPanel" Style="{StaticResource ContentStackPanelStyle}">

                <TextBlock x:Name="HeaderText" Style="{StaticResource HeaderTextStyle}" 
                           Text="{Binding Path=ApplicationStrings.CalcPageTitle, Source={StaticResource ResourceWrapper}}"/>
                <TextBlock Style="{StaticResource ContentTextStyle}" 
                           Text="此功能可以帮助您快速验证下载后的ISO文件是否为官方原版文件，确保您的计算机安全。"/>

                <toolkit:BusyIndicator BusyContent="{Binding Path=ApplicationStrings.BusyIndicatorMessage, Source={StaticResource ResourceWrapper}}"
                             IsBusy="{Binding IsWorking}">
                    <Border Margin="30,30,30,10" BorderBrush="DarkGray" BorderThickness="1" Width="640" HorizontalAlignment="Left">
                        <StackPanel Margin="10">
                            <TextBlock Margin="0,0,0,3" Foreground="Green" Text="选择一个文件进行验证："></TextBlock>
                            <StackPanel Orientation="Horizontal">
                                <TextBox IsReadOnly="True" x:Name="inputFile"
                                         AllowDrop="True" Width="365" HorizontalAlignment="Left" Text=" "
                                         Drop="InputFile_Drop" />
                                <Button Content="浏览" Click="Button_Click" x:Name="btnBrowse"  Margin="5,0,0,0"  />
                            </StackPanel>



                            <StackPanel Orientation="Horizontal" x:Name="panelVerify"
                             Margin="0,10,0,10" Visibility="{Binding ElementName=btnBrowse, Path=IsEnabled, Converter={StaticResource NotBooleanConverter}}" >
                                <ProgressBar x:Name="progVerify"
                            
                             HorizontalAlignment="Left" Width="400" Height="24"  />
                                <TextBlock Margin="5,0,0,0" Text="{Binding ElementName=progVerify, Path=Value, StringFormat=\{0:F\}%}" />
                            </StackPanel>

                            <TextBlock  x:Name="textResult" Foreground="#FF8789EB"
                                    TextWrapping="Wrap"
                                    Visibility="{Binding ElementName=panelVerify, Path=Visibility, Converter={StaticResource NotVisibilityConverter}}" 
                                    MouseRightButtonDown="Result_MouseRightButtonDown" />
                        </StackPanel>
                    </Border>
                </toolkit:BusyIndicator>

            </StackPanel>

        </ScrollViewer>
    </Grid>
</navigation:Page>
